//
//  TestBedViewController.m
//  ViewControllersContainer
//
//  Created by 李劲成 on 16/4/13.
//  Copyright © 2016年 ljc. All rights reserved.
//

#import "TestBedViewController.h"
#import "FlipViewControllers.h"
@interface TestBedViewController ()

@end

@implementation TestBedViewController


- (void)loadView {
    
    self.view = [[[UIView alloc]init]autorelease];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.leftBarButtonItem = BARBUTTON(@"Modal", @selector(modal:));
    self.navigationItem.rightBarButtonItem = BARBUTTON(@"push", @selector(push:));
    if (!IS_IPAD) {
        return;
    }
    UIViewController *flip = [[self newFlipController]retain];
    PREPCONSTRAINTS(flip.view, NO);
    CONSTRAIN_SIZE(flip.view, 400.0, 300.0);
    CENTER_VIEW(self.view, flip.view);
    // Setup Child View Controller
    [self addChildViewController:flip];
    [self.view addSubview:flip.view];
    [flip didMoveToParentViewController:self];
    [flip release];
}

- (UIViewController *)newFlipController {
    
    UIViewController *blueController = [[UIViewController alloc] init];
    blueController.view.backgroundColor = [UIColor blueColor];
    
    UIViewController *redController = [[UIViewController alloc] init];
    redController.view.backgroundColor = [UIColor redColor];
    
    FlipViewControllers *flipController = [[[FlipViewControllers alloc]  initWithFrontController:blueController andBackController:redController]autorelease];
#warning ??
    // 演示视图控制器过渡时的样式
    flipController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;// 默认过渡样式
    // 模态推出时的样式
    flipController.modalPresentationStyle = UIModalPresentationFormSheet;
    
    [blueController release];
    [redController release];
    return flipController;
}

- (void)modal:(id)sender {
    
    [self.navigationController presentViewController:[self newFlipController] animated:YES completion:nil];

}

- (void)push:(id)sender {
    
     [self.navigationController pushViewController:[self newFlipController] animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
